package com.df.tv.launcher.model;

import android.content.Context;
import android.content.Intent;

import com.df.tv.tm.aidl.AppInfoEntity;
import com.telecom.tv189.comlib.dynamicui.json.ActionPerformer;
import com.telecom.tv189.comlib.dynamicui.json.entity.IntentAction;
import com.telecom.tv189.comlib.util.Log;

public class LauncherActionPerformer extends ActionPerformer {

    @Override
    protected Intent genPackageIntent(Context context, IntentAction action, Intent custom) throws PerformException {
        String packageName = action.getApppkg();
        if (packageName == null || "".equals(packageName))
            throw new ArgumentsErrorException(ERR_MSG_NO_PKG_NAME);

        Intent intent = new Intent("com.telcom.tv189.action.AppAction");
        intent.putExtra("ACTION_KEY", 0);//install action
        AppInfoEntity appInfo = new AppInfoEntity();
        appInfo.setApkname(packageName);
        intent.putExtra("TARGET_APP_KEY", appInfo);//install action

        customIntent(intent, custom);
        Log.e(getClass().getSimpleName(), "genPackageIntent");
        return intent;
    }
}
